function Cookie(){

}
Cookie.prototype.set = function(name,value,seconds){
    // 要以服务端时间为准
    const time = new Date()
    time.setTime(time.getTime() - 8*1000*60*60 + seconds*1000)
    document.cookie = `${name}=${value};expires=${time}`
}
Cookie.prototype.get = function(name){
    const cookieArr = document.cookie.split('; ')
    const obj = {}
    cookieArr.forEach((elem)=>{
        console.log(elem)
        const index = elem.indexOf('=')
        const name = elem.slice(0,index)
        const value = elem.slice(index+1)
        obj[name] = value
    })
    return obj[name]
}
Cookie.prototype.delete = function(name){
    // cookie是不能通过代码直接删除，只能修改它的过期时间
    this.set(name,'',-1)
}